home *** CD-ROM | disk | FTP | other *** search
/ Wonky Flux Batch 2019 02 / Wonky_Flux_Batch_2019-02.zip / Wonky Flux Batch 2019-02 / 075 - Clash of Arms.dsk / WAR.MOVE.S < prev    next >
Text File  |  2019-02-17  |  22KB  |  558 lines

  1.           on nocar goto link.term
  2.           ch$=pc$
  3.           open #1,"h:war.map1":open #2,"h:war.map2"
  4.           gosub scanmap
  5.           close #1:open #1,"H:COORDS"
  6.           position #1,8,0:input #1 ky,ky
  7.           if ky<24 ma=0:mp=0:bo=24:yy=1:yo=1:else mp=1:bo=47:yy=24:yo=24:ma=1
  8.           close
  9.           open #1,"h:war.map1":open #2,"h:war.map2"
  10.           xx=1:xo=1:ta=1
  11.           gosub printmap
  12.  
  13.           
  14. MainLoop
  15.           gosub SetAttacksZero
  16.           gosub Split
  17.           gosub readcoords
  18.           gosub Merge
  19.           link "a:war.start","quitgame"
  20.  
  21. SetAttacksZero
  22.           close #1:open #1,"h:attacks"
  23.           p1=asc(ch$)-97
  24.           for p2=0 to 5
  25.           position #1,60,p2,p1*10
  26.           print #1,0
  27.           next
  28.           close #1:open #1,"h:war.map1"
  29.           return
  30.  
  31. Merge
  32.           x=40:y=bo:gosub screen:print "Merge armies ? (Y/[N])                  ";
  33.           gosub getkey
  34.           if (ka$<>"Y") and (ka$<>"y") return
  35.           y=yy:gosub getline1:x=xx:gosub screen:gosub invon:print mid$(l1$,xx,1);:gosub invoff
  36.           create "h:merges"
  37.           close #1:open #1,"h:merges":print #1,0:print #1,0:close #1:open #1,"h:war.map1"
  38. Merge1
  39.           x=40:y=bo:gosub screen:print "Source. <cr> selects, <ESC> exits merge ";
  40. Merge1.1
  41.           xo=xx:yo=yy:x=xx:y=yy:gosub screen
  42.           gosub MapMove
  43.           if ka$=chr$(27) goto MergeEnd
  44.           aa$=mid$(l1$,xx,1)
  45.           if instr(aa$,ch$) kk=1:else kk=0
  46.           gosub armystrength:bb$=mid$(l2$,xx,1):bb=ar
  47.           if (bb=0) or (kk=0) x=40:y=bo:gosub screen:print "No armies there.                        ";:goto merge1.1
  48.           close #1:open #1,"h:merges":dd=0
  49. Merge1.2
  50.           input #1,x:input #1,y:if (x=xx) and (y=yy) dd=1
  51.           if not (eof(1)) goto merge1.2
  52.           close #1:open #1,"h:war.map1"
  53.           if dd=1 x=40:y=bo:gosub screen:print "That army has already merged.           ";:goto merge1.1
  54.           xf=xx:yf=yy
  55.           x=40:y=bo:gosub screen:print "Destination. <cr> selects, <ESC> aborts";
  56. Merge2
  57.           x=xx:y=yy:xo=xx:yo=yy:gosub screen
  58.           gosub MapMove
  59.           if ka$=chr$(27) goto Merge1
  60.           if (xx=xf) and (yy=yf) goto Merge1
  61.           if xx>xf dx=xx-xf:else dx=xf-xx
  62.           if yy>yf dy=yy-yf:else dy=yf-yy
  63.           if (dx>1) or (dy>1) x=40:y=bo:gosub screen:print "Not within 1 square                     ";:goto Merge2
  64.           y=yy:c$=mid$(l1$,xx,1)
  65.           if instr(c$,ch$) kk=1:else kk=0
  66.           gosub armystrength:dd=ar:dd$=mid$(l2$,xx,1)
  67.           if (dd=0) or (kk=0) x=40:y=bo:gosub screen:print "No armies there.                        ";:goto merge2
  68.           mx=9-dd
  69. Merge3
  70.           x=40:y=bo:gosub screen:print "How many? (0-"bb", max of "mx")              ";chr$(8);
  71.           get ka$:ka=val(ka$):if ka=0 goto merge1
  72.           if (ka>bb) or (ka<0) goto merge3
  73.           if ka>mx goto merge3
  74.           bb=bb-ka
  75.           dd=dd+ka
  76.           if (bb=0) and (asc(aa$)>96) and (asc(bb$)<64) aa$=" "
  77.           if (bb=0) and (asc(aa$)>96) and (asc(bb$)>64) aa$="+"
  78.           if (asc(bb$)>64) and (bb>0) bb$=chr$(bb+64):else bb$=chr$(bb+48)
  79.           if (asc(dd$)>64) dd$=chr$(dd+64):else dd$=chr$(dd+48)
  80.           position #1,80,yf-1,xf-1:print #1,aa$;
  81.           position #2,80,yf-1,xf-1:print #2,bb$;
  82.           position #2,80,yy-1,xx-1:print #2,dd$;
  83.           close #1:open #1,"h:merges":append #1
  84.           print #1,xx:print #1,yy:close #1:open #1,"h:war.map1"
  85.           x=9:y=bo:gosub screen:print dd;" ";
  86.           x=xf:y=yf:gosub screen:print aa$;
  87.           goto merge1
  88.  
  89. MergeEnd
  90.           kill "h:merges"
  91.           x=xx:y=yy:gosub getline1
  92.           gosub screen:gosub invoff:print mid$(l1$,xx,1);:return
  93.  
  94. Split
  95.           x=40:y=bo:gosub screen:print "Split armies ? (Y/[N])                  ";
  96.           gosub getkey
  97.           if (ka$<>"Y") and (ka$<>"y") return
  98.           y=yy:gosub getline1:x=xx:gosub screen:gosub invon:print mid$(l1$,xx,1);:gosub invoff
  99.           create "h:splits"
  100.           close #1:open #1,"h:splits":print #1,0:print #1,0:close #1:open #1,"h:war.map1"
  101. Split1
  102.           x=40:y=bo:gosub screen:print "Source. <cr> selects, <ESC> exits split ";
  103. Split1.1
  104.           xo=xx:yo=yy:x=xx:y=yy:gosub screen
  105.           gosub MapMove
  106.           if ka$=chr$(27) goto SplitEnd
  107.           aa$=mid$(l1$,xx,1)
  108.           if instr(aa$,ch$) kk=1:else kk=0
  109.           gosub armystrength:bb$=mid$(l2$,xx,1):bb=ar
  110.           if (bb<2) or (kk=0) x=40:y=bo:gosub screen:print "Not enough armies there.               ";:goto split1.1
  111.           close #1:open #1,"h:splits":dd=0
  112. Split1.2
  113.           input #1,x:input #1,y:if (x=xx) and (y=yy) dd=1
  114.           if not (eof(1)) goto split1.2
  115.           close #1:open #1,"h:war.map1"
  116.           if dd=1 x=40:y=bo:gosub screen:print "That army has already split.           ";:goto split1.1
  117.           xf=xx:yf=yy
  118.           x=40:y=bo:gosub screen:print "Destination. <cr> selects, <ESC> aborts";
  119. Split2
  120.           x=xx:y=yy:xo=xx:yo=yy:gosub screen
  121.           gosub MapMove
  122.           if ka$=chr$(27) goto Split1
  123.           if (xx=xf) and (yy=yf) goto Split1
  124.           if xx>xf dx=xx-xf:else dx=xf-xx
  125.           if yy>yf dy=yy-yf:else dy=yf-yy
  126.           if (dx>1) or (dy>1) x=40:y=bo:gosub screen:print "Not within 1 square                     ";:goto Split2
  127.           y=yy:c$=mid$(l1$,xx,1)
  128.           if (c$=":") and (bb<9) x=40:y=bo:gosub screen:print "Not enough armies for a boat.           ";:gosub getkey:goto Split1
  129.           if c$=":" x=40:y=bo:gosub screen:print "Create Boat? ([Y]/N)                    ";:gosub getkey:if ka$="N" goto Split1
  130.           if instr(c$,"#*=") kk=1:else kk=0
  131.           gosub armystrength:dd=ar:dd$=mid$(l2$,xx,1)
  132.           if (dd>0) or (kk=1) x=40:y=bo:gosub screen:print "That space taken.                       ";:goto split2
  133. Split3
  134.           if c$=":" bb=bb-8:aa$="+":dd$="0":if (asc(bb$)>64) bb$=chr$(bb+64):else bb$=chr$(bb+48)
  135.           if c$=":" gosub upboat:goto splitsave
  136.           x=40:y=bo:gosub screen:print "How many? (1-"bb-1")                        ";chr$(8);
  137.           get ka$:ka=val(ka$):if ka=0 goto split1
  138.           if (ka>bb-1) or (ka<0) goto split3
  139.           bb=bb-ka
  140.           dd=ka
  141.           if asc(aa$)<96 aa$=chr$(asc(aa$)+32)
  142.           if (asc(bb$)>64) bb$=chr$(bb+64):else bb$=chr$(bb+48)
  143.           if c$="+" dd$=chr$(dd+64):else dd$=chr$(dd+48)
  144.           if ((asc(c$)>64) and (asc(c$)<91)) or (c$="*") aa$=chr$(asc(aa$)-32)
  145. splitsave
  146.           position #1,80,yy-1,xx-1:print #1,aa$;
  147.           position #2,80,yf-1,xf-1:print #2,bb$;
  148.           position #2,80,yy-1,xx-1:print #2,dd$;
  149.           close #1:open #1,"h:splits":append #1
  150.           print #1,xx:print #1,yy:close #1:open #1,"h:war.map1"
  151.           x=9:y=bo:gosub screen:print dd;" ";
  152.           x=xx:y=yy:gosub screen:gosub invon:print aa$;:gosub invoff
  153.           goto split1
  154.  
  155. SplitEnd
  156.           kill "h:splits"
  157.           x=xx:y=yy:gosub getline1:gosub screen:gosub invoff
  158.           print mid$(l1$,xx,1);:return
  159.  
  160. flsh
  161.           y=yy:gosub getline1
  162.           x=xx:aa$=mid$(l1$,xx,1)
  163.           for kz=1 to 2
  164.           gosub screen:gosub invon:print aa$;
  165.           gosub screen:gosub invoff:print aa$;
  166.           next
  167.           gosub screen:gosub invon:print aa$;chr$(8);:gosub invoff
  168.           return
  169. search
  170.           kx=xx:ky=yy:gosub mapmove
  171.           gosub erase
  172.           xx=kx:yy=ky
  173.           if ma<>mp ma=mp:gosub printmap
  174.           gosub flsh
  175.           x=9:y=bo:gosub screen:gosub armystrength:print ar;" ";
  176.           gosub getterrain:x=24:y=bo:gosub screen:print ms$;
  177.           goto Move1
  178. Move
  179.           if ma<>mp ma=mp:gosub printmap
  180.           gosub flsh
  181.           count=1
  182. Move1
  183.           y=yy:x=xx:gosub screen:gosub getline1:gosub invon:print mid$(l1$,xx,1);chr$(8);:gosub invoff
  184.           gosub armystrength:as=ar:gosub getline1
  185.           aa$=mid$(l1$,xx,1):bb$=mid$(l2$,xx,1)
  186.           if instr(bb$,"ABCDEFGHI") bt=1:else bt=0
  187.           xf=xx:yf=yy
  188.           x=40:y=bo:gosub screen:print "Move "count"("nm"),< > Select,ESC-abort,S-search ";
  189. Move2
  190.           x=9:y=bo:gosub screen:gosub armystrength:print ar;" ";
  191.           gosub getterrain:x=24:y=bo:gosub screen:print ms$;
  192.           xo=xx:yo=yy:x=xx:y=yy:gosub screen:ok=1:gosub mapmove
  193.           if (kc>1) and ((ka$="<") or (ka$=",")) kd=kc:goto sback0
  194.           if (kc<nb) and ((ka$=">") or (ka$=".")) gosub scanforw:return
  195.           if instr(ka$,",.<>") goto move2
  196.           if ka$="S" x=40:y=bo:gosub screen:ok=0:print "Search Map Mode.  <ESC> to abort        ";:goto Search
  197.           if xx>xf dx=xx-xf:else dx=xf-xx
  198.           if yy>yf dy=yy-yf:else dy=yf-yy
  199.           y=yy:gosub getline1:c$=mid$(l1$,xx,1)
  200.           if (count=1) and (ka$=chr$(27)) ta=ta+1
  201.           if ka$=chr$(27) x=xx:y=yy:gosub screen:print c$;:gosub zerocoords:return
  202.           if (dx>1) or (dy>1) x=40:y=bo:gosub screen:print "Not within 1 square                     ";:gosub erase:xx=xf:yy=yf:gosub flsh:goto move2
  203.           if (xx=xf) and (yy=yf) gosub showchar:return
  204.           if instr(c$,"=#") x=40:y=bo:gosub screen:print "Impassable                              ";:gosub erase:xx=xf:yy=yf:gosub flsh:goto move2
  205.           if (c$=":") and (bt=0) x=40:y=bo:gosub screen:print "Need a boat.                            ";:gosub erase:xx=xf:yy=yf:gosub flsh:goto move2
  206.           if instr(aa$,c$) y=yy:gosub getline2:if mid$(l2$,xx,1)<>"0" x=40:y=bo:gosub screen:print "No stacking while moving.               ";:gosub erase:xx=xf:yy=yf:gosub flsh:goto move2
  207.           if instr(c$,"ABCDEF") kk=1:else kk=0
  208.           if (kk=1) and (aa$<>c$) and (aa$<>chr$(asc(c$)+32)) goto warfare
  209. Move3
  210.           gosub savemove
  211.           if count=1 gosub zerocoords:ta=ta+1
  212.           count=count+1:if count=1+nm gosub showchar:return
  213.           goto Move1
  214.  
  215. showchar
  216.           x=xx:y=yy:gosub screen
  217.           print aa$      ;
  218.           return
  219.  
  220. zerocoords
  221.           close #1:open #1,"h:coords"
  222.           position #1,8,kc-1:print #1,0,0
  223.           close #1:open #1,"H:WAR.MAP1"
  224.           return
  225.  
  226. savemove
  227.           if (bt=1) and (c$<>":") d$="+"
  228.           if (bt=1) and (c$=":") d$=":"
  229.           if (bt=0) and (asc(aa$)>96) d$=" "
  230.           if (asc(aa$)>64) and (asc(aa$)<91) d$=aa$
  231.           if instr(c$,pc$) goto save2
  232.           if (c$="*") or ((asc(c$)>64) and (asc(c$)<91)) ct=ct+1
  233. save2
  234.           if (c$="*") or ((asc(c$)>64) and (asc(c$)<91)) aa$=chr$(asc(aa$)-32):else if ((asc(aa$)>64) and (asc(aa$)<91)) aa$=chr$(asc(aa$)+32)
  235.           position #1,80,yy-1,xx-1
  236.           print #1,aa$   ;
  237.           if (c$="+") and (bt=0) bb$=chr$(val(bb$)+64)
  238.           if (c$<>":") and (c$<>"+") and (bt=1) bb$=chr$(asc(bb$)-16)
  239.           position #2,80,yy-1,xx-1
  240.           print #2,bb$   ;
  241.           position #2,80,yf-1,xf-1
  242.           print #2,"0"   ;
  243.           position #1,80,yf-1,xf-1
  244.           print #1,d$    ;
  245.           if ma<>mp x=xx:y=yy:gosub screen:gosub invon:print aa$;:gosub invoff:mp=ma:return
  246.           x=xf:y=yf:gosub screen:print d$;
  247.           x=xx:y=yy:gosub screen:gosub invon:print aa$;:gosub invoff
  248.           return
  249.  
  250. upnew
  251.           p1=(instr(p1$,"ABCDEF"))-1
  252.           p2=(instr(p2$,"ABCDEF"))-1
  253.           close #1:open #1,"h:attacks"
  254.           position #1,60,p1,10*p2
  255.           input #1,qn
  256.           qn=qn+1
  257.           position #1,60,p1,10*p2
  258.           print #1,qn
  259. uptot
  260.           p1=(instr(p1$,"ABCDEF"))-1
  261.           p2=(instr(p2$,"ABCDEF"))-1
  262.           close #1:open #1,"h:attacks"
  263.           position #1,60,p1,(10*p2)+5
  264.           input #1,qt
  265.           qt=qt+1
  266.           position #1,60,p1,(10*p2)+5
  267.           print #1,qt
  268.           close #1
  269.           open #1,dr$+"game.data."+gn$
  270.           position #1,1,p2*5+300
  271.           input #1,at
  272.           at=at-1
  273.           position #1,1,p2*5+300
  274.           print #1,at
  275.           close #1:open #1,"h:war.map1"
  276.           return
  277. upboat
  278.           p1=(instr(p1$,"ABCDEF"))-1
  279.           close #1:open #1,dr$+"game.data."+gn$
  280.           position #1,1,p1*5+300:input #1,at:at=at-6
  281.           position #1,1,p1*5+300:print #1,at:close #1:open #1,"h:war.map1"
  282.           return
  283.  
  284. losecity
  285.           p2=(instr(p2$,"ABCDEF"))-1
  286.           close #1:open #1,dr$+"game.data."+gn$
  287.           position #1,1,p2*5+270
  288.           input #1,at
  289.           at=at-1
  290.           position #1,1,p2*5+270
  291.           print #1,at
  292.           close #1:open #1,"h:war.map1"
  293.           return
  294.  
  295. warfare
  296.           gosub armystrength:hs=ar:hs$=mid$(l2$,xx,1)
  297.           if hs=0 x=40:y=bo:gosub screen:print "City captured!           Press a key -> ";:p2$=c$:gosub losecity:gosub getkey:goto move3
  298.           x=1:y=bo:gosub screen:print "Attacking - You:"as"  Him:"hs"              ";
  299.           kk=as
  300.           i=1
  301. warfare1
  302.           x=30:y=bo:gosub screen:print "Army #"i"  ";
  303.           gosub rndm
  304.           if (asc(c$)<91) and (asc(c$)>64) zl=zl-10
  305.           if (as>hs) zl=zl+((as-hs)*3)
  306.           if (hs>as) zl=zl-((hs-as)*3)
  307.           if zl<=20 print "Your army killed!                        ";:as=as-1:p1$=c$:p2$=aa$:gosub uptot:goto warfare2
  308.           if zl<=50 print "Both armies killed!                     ";:hs=hs-1:as=as-1:p1$=c$:p2$=aa$:gosub uptot:p1$=aa$:p2$=c$:gosub upnew:goto warfare2
  309.           if zl<=80 print "Attack repelled!                         ";:goto warfare2
  310.           print "His army killed!                         ";:hs=hs-1:p1$=aa$:p2$=c$:gosub upnew
  311. warfare2
  312.           x=17:y=bo:gosub screen:print as;" ";:x=24:gosub screen:print hs;" ";
  313.           x=58:y=bo
  314.           if (as=0) or (hs=0) or (i=kk) gosub screen:print" Attack over-Hit a key";:gosub getkey:goto warend
  315.           x=58:gosub screen:print   " ESC-Quit,<cr>-cont   ";:gosub getkey
  316.           if ka$=chr$(27) goto warend
  317.           i=i+1:goto warfare1
  318. warend
  319.           f$=aa$:g$=c$
  320.           x=1:y=bo:gosub screen:print "Armies: ";hs;"       ";
  321.           x=15:gosub screen:print "Terrain: ";ms$;"                ";
  322.           if (hs=0) and (asc(hs$)<64) hs$="0"
  323.           if as=0 bb$="0"
  324.           if (hs=0) and (asc(c$)<96) and (as>0) p2$=c$:gosub losecity
  325.           if (hs=0) and (asc(hs$)>64) c$="+"
  326.           if (hs=0) and (asc(hs$)<64) and (asc(c$)>96) c$=" "
  327.           if (hs=0) and (as>0) and (bt=1) bb$=chr$(as+64):goto move3
  328.           if (hs=0) and (as>0) bb$=chr$(as+48):goto move3
  329.           if (as=0) and (bt=1) aa$="+"
  330.           if (as=0) and (bt=0) and (asc(aa$)>96) aa$=" "
  331.           if (as=0) and (hs=0) goto warwrite
  332.           if (as=0) and (asc(hs$)>64) hs$=chr$(hs+64)
  333.           if (as=0) and (asc(hs$)<64) hs$=chr$(hs+48)
  334.           if (as=0) goto warwrite
  335.           if (bt=1) bb$=chr$(as+64):else bb$=chr$(as+48)
  336.           if (asc(hs$)>64) hs$=chr$(hs+64):else hs$=chr$(hs+48)
  337. warwrite
  338.           if count=1 gosub zerocoords:ta=ta+1
  339.           position #1,80,yy-1,xx-1:print #1,c$;
  340.           position #1,80,yf-1,xf-1:print #1,aa$;
  341.           position #2,80,yy-1,xx-1:print #2,hs$;
  342.           position #2,80,yf-1,xf-1:print #2,bb$;
  343.           if ma<>mp x=xx:y=yy:gosub screen:gosub invon:print c$;:gosub invoff:mp=ma:return
  344.           x=xf:y=yf:gosub screen:print aa$;
  345.           x=xx:y=yy:gosub screen:print c$;
  346.           return
  347.  
  348. map0
  349.           if ((ka$="8") or (ka$='W')) and (yy<>1) yy=yy-1:gosub erase
  350.           if ((ka$="2") or (ka$='X')) and (yy<23) yy=yy+1:gosub erase
  351.           return
  352.  
  353. map1
  354.           if ((ka$="8") or (ka$='W')) and (yy<>24) yy=yy-1:gosub erase
  355.           if ((ka$="2") or (ka$='X')) and (yy<46) yy=yy+1:gosub erase
  356.           return
  357.  
  358. getkey
  359.           ka=key(0):if ka=0 goto getkey
  360.           ka$=chr$(ka)
  361.           if asc(ka$)>96 ka$=chr$(asc(ka$)-32)
  362.           poke 99,0:poke 100,0
  363.           return
  364.  
  365. map2
  366.           if (ka$="K") and (xx<70) xx=xx+10:gosub erase:goto mapmv2
  367.           if (ka$="J") and (xx>10) xx=xx-10:gosub erase:goto mapmv2
  368.           if (ka$="I") and (yy>29) and (ma=1) yy=yy-5:gosub erase:goto mapmv2
  369.           if (ka$="I") and (yy>6) and (ma=0) yy=yy-5:gosub erase:goto mapmv2
  370.           if (ka$="M") and (yy<18) and (ma=0) yy=yy+5:gosub erase:goto mapmv2
  371.           if (ka$="M") and (yy<41) and (ma=1) yy=yy+5:gosub erase:goto mapmv2
  372.           if (ka$="I") and (ma=1) ka$="8":yy=24:goto map3
  373.           if (ka$="M") and (ma=0) ka$="2":yy=23:goto map3
  374.  
  375. mapmove
  376.           gosub getkey
  377.           if asc(ka$)>96 ka$=chr$(asc(ka$)-32)
  378.           if instr(ka$,"IJKM") kk=1:else kk=0
  379.           if (kk) and (ok=0) goto map2
  380. map3
  381.           if instr(ka$,"147QAZ") ml=1:else ml=0
  382.           if instr(ka$,"369CDE") mr=1:else mr=0
  383.           if (ml) and (xx<>1) xx=xx-1:gosub erase
  384.           if (mr) and (xx<79) xx=xx+1:gosub erase
  385.           if instr(ka$,"QE79") ka$="8":else if instr(ka$,"ZC13") ka$="2"
  386.           if ((ka$="8") or (ka$='W')) and (yy=24) and (ma=1) ma=0:bo=24:yy=23:gosub printmap:xo=xx:yo=yy:goto mapmv2
  387.           if ((ka$="2") or (ka$='X')) and (yy=23) and (ma=0) ma=1:bo=47:yy=24:gosub printmap:xo=xx:yo=yy:goto mapmv2
  388.           if ma=0 gosub map0:else gosub map1
  389. mapmv2
  390.           if ka$=chr$(27) return
  391.           if (ka$=chr$(13)) and (ok=0) return
  392.           if instr(ka$," YN5") return
  393.           y=yy:gosub getline1
  394.           x=xx:y=yy:gosub screen:gosub invon:print mid$(l1$,xx,1);chr$(8);:gosub invoff
  395.           if instr(ka$,"QWEASDZXC789456123<>,.") kk=1:else kk=0
  396.           if (ok) and (kk) ok=0:return
  397.           if instr(mid$(l1$,xx,1),"ABCDEF") x=9:y=bo:gosub screen:gosub armystrength:print ar;" ";:else if ar<>0 x=9:y=bo:gosub screen:print "0";:ar=0
  398.           if mid$(l1$,xx,1)<>tr$ gosub getterrain:x=24:y=bo:gosub screen:print ms$;
  399.           x=xx:y=yy:gosub screen
  400.           goto mapmove
  401.  
  402. getterrain
  403.           a$=mid$(l1$,xx,1):if instr(a$,"ABCDEF") am=1:else am=0
  404.           y=yy:gosub getline2:b$=mid$(l2$,xx,1)
  405.           if a$="#" ms$="Impassable"
  406.           if a$=" " ms$="Land      "
  407.           if a$=":" ms$="Water     "
  408.           if a$="+" ms$="Empty Boat"
  409.           if a$="=" ms$="Deep Water"
  410.           if a$="*" ms$="City      "
  411.           if (am) and (asc(a$)>96) and (asc(b$)<65) ms$="Army      "
  412.           if (asc(a$)>96) and (am) and (asc(b$)>64) ms$="Army/Boat "
  413.           if (asc(a$)>64) and (asc(a$)<91) ms$="Army/City "
  414.           tr$=a$
  415.           return
  416.  
  417. armystrength
  418.           y=yy:gosub getline2
  419.           a$=mid$(l2$,xx,1)
  420.           if instr(a$,"0123456789") ar=val(a$):return
  421.           if instr(a$,"ABCDEFGHI") ar=asc(a$)-64:return
  422.           ar=0:return 
  423.  
  424.                          ;
  425.                          ; Scan the map for character CH$ and records coordinates in H:COORDS
  426.                          ;
  427.  
  428. ScanMap
  429.           x=40:y=bo:gosub screen
  430.           print \"Wait..scanning map...                   ";
  431.           kill "H:COORDS":create "H:COORDS"
  432.           kc=0:kb=0:if (asc(ch$)>96) and (asc(ch$)<123) kb=1:kb$=chr$(asc(ch$)-32)
  433.           for y = 2 to 45
  434.           gosub getline1:gosub getline2
  435.           ka=instr(ch$,l1$)
  436.           if not ka goto PastCheck
  437.  
  438.           for x = ka to 79
  439.           ka$=mid$(l1$,x,1)
  440.           if ch$=ka$ gosub FoundMatch
  441.           if kb and (ka$=kb$) then if val(mid$(l2$,x,1))>0 gosub FoundMatch
  442.           next
  443. PastCheck
  444.           next:nb=kc:kc=0:return
  445.  
  446. FoundMatch
  447.           close #1:open #1,"H:COORDS"
  448.           position #1,8,kc:print #1 x,y
  449.           position #1,8,kc+1:print #1 0,0
  450.           close #1:open #1,"H:WAR.MAP1"
  451.           kc=kc+1
  452.           return
  453.  
  454.  
  455.                          ;
  456.                          ; Read coordinates from "H:COORDS" and calls Move routine
  457.                          ; Make sure KC=0 before calling, and don't use KC in move routine
  458.                          ;
  459.  
  460. ReadCoords
  461.           if (ta>nb) return
  462.           close #1:open #1,"H:COORDS"
  463.           position #1,8,kc:input #1 kx,ky
  464.           close #1:open #1,"H:WAR.MAP1"
  465.           if (kx=0) and (ky=0) kc=kc+1:gosub scanback:goto readcoords
  466.           xx=kx:yy=ky
  467.           KC=KC+1:if yy<24 mp=0:bo=24:else mp=1:bo=47
  468.           gosub move
  469.           goto ReadCoords
  470.  
  471. sback0
  472.           gosub scanback
  473.           if kd=kc x=xx:y=yy:gosub invon:gosub screen:print a$;:gosub invoff:goto move2
  474.           return
  475. Scanback
  476.           gosub erase
  477.           kk=kc:kc=kc-1
  478.           close #1:open #1,"H:coords"
  479. Sback2
  480.           kc=kc-1
  481.           if kc<0 kc=kk:close #1:open #1,"H:war.map1":return
  482.           position #1,8,kc:input #1,kx,ky
  483.           if (kx>0) and (ky>0) close #1:open #1,"h:war.map1":return
  484.           goto sback2
  485. scanforw
  486.           gosub erase
  487.           kk=kc
  488.           close #1:open #1,"h:coords"
  489. sforw2
  490.           if kc>nb kc=kk:close #1:open #1,"h:war.map1":return
  491.           position #1,8,kc:input #1,kx,ky
  492.           if (kx>0) and (ky>0) close #1:open #1,"h:war.map1":return
  493.           kc=kc+1
  494.           goto sforw2
  495.           
  496. erase
  497.           y=yo:gosub getline1
  498.           a$=mid$(l1$,xo,1)
  499.           x=xo:y=yo:gosub screen
  500.           print a$       ;
  501.           xo=xx:yo=yy
  502.           return
  503.  
  504. printmap
  505.           gosub home
  506.           if ma=0 fn=1:bo=24:else fn=24:bo=47
  507.           for y=fn to fn+22
  508.           gosub getline1
  509.           print l1$
  510.           next
  511.           x=xx:y=yy:gosub getline1:gosub armystrength
  512.           x=1:y=bo:gosub screen:print "Armies: ";ar;" ";
  513.           x=15:gosub screen:print "Terrain: ";ms$;
  514.           return
  515.  
  516. Screen
  517.           if ma=0 ve=y:else ve=y-23
  518.           print #3 chr$(30);chr$(31+x);chr$(31+ve);
  519.           if (pt) or ((pt=0) and (an=0)) print #4 chr$(30);chr$(31+x);chr$(31+ve);
  520.           if AN print #4 chr$(27); "["; ve; ";"; x; "f";
  521.           return
  522.  
  523. InvOn
  524.           print #3 chr$(15);
  525.           if (pt) or ((pt=0) and (an=0)) print #4 chr$(15);
  526.           if an print #4 chr$(27);"[1m";
  527.           return
  528.  
  529. InvOff
  530.           print #3 chr$(14);
  531.           if (pt) or ((pt=0) and (an=0)) print #4 chr$(14);
  532.           if an print #4 chr$(27);"[0m";
  533.           return
  534.  
  535. Home
  536.           print #3 chr$(12);
  537.           if (pt) or ((pt=0) and (an=0)) print #4 chr$(12);
  538.           if an print #4 chr$(27);"[H";chr$(27);"[J";
  539.           return
  540.  
  541. rndm
  542.           zl$=rnd$
  543.           zl=((random(10000)+100)/100):if zl>100 then zl=zl-1
  544.           return
  545.  
  546. getline1
  547.           free
  548.           position #1,80,y-1
  549.           input #1,l1$
  550.           return
  551. getline2
  552.           position #2,80,y-1
  553.           input #2,l2$
  554.           return
  555.  
  556. link.term
  557.           link "a:war.start","termgame"
  558.